package day6;

import java.util.Random;
import java.util.Scanner;

public class t7 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int []arr1=creatA();
        for (int i = 0; i < arr1.length; i++) {
            System.out.print(arr1[i]+" ");
        }
        System.out.println("");
        int []arr2=new int[7];
        for (int i = 0; i < arr2.length; i++) {
            if(i<6)System.out.print("请输入第"+(i+1)+"个红球号码");
            else System.out.print("请输入蓝球球号码");
            arr2[i]= sc.nextInt();
        }
        int red=compare(arr1,arr2);
        int blue=0;
        if(arr1[6]==arr2[6]) blue=1;
        int bonus=money(red,blue);
        System.out.print("恭喜你，可获得"+bonus+"元的奖金");
    }

    public static int [] creatA() {
        int []arr=new int [7];
        Random r=new Random();
        for (int i = 0; i < arr.length; i++) {
            if(i!= arr.length-1) arr[i]=r.nextInt(33)+1;
            else arr[i] =r.nextInt(16)+1;
        }
        return arr;
    }
    public static int compare(int []arr1,int []arr2){
        int count=0;
        for (int i = 0; i < arr1.length-1; i++) {
            for (int i1 = 0; i1 < arr2.length-1; i1++) {
                if(arr2[i1]==arr1[i]) {
                    count++;
                    break;
                }
            }
        }
        return count;
    }
    public static int money(int red,int blue){
        int bonus=0;
        switch(red){
            case 0,1,2->{
                if (blue==1) bonus=5;
            }
            case 3->  bonus=10;
            case 4->{
                if(blue==0) bonus=10;
                else bonus =200;
            }
            case 5->{
                if(blue==0) bonus=200;
                else bonus =3000;
            }
            case 6->{
                if(blue==0) bonus=5000000;
                else bonus =10000000;
            }
        }
        return bonus;
    }

}
